<?php

/**
 * feedbackWidget actions.
 *
 * @package    jobeet
 * @subpackage feedbackWidget
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class feedbackWidgetActions extends sfActions
{
  public function executeJoinNewsletter (sfWebRequest $request)
  {
    $this->setLayout(false);
    $dbEmail = Doctrine::getTable('Newsletter')->findBy('email', $request->getParameter('email'));
    if (!$dbEmail[0]['id']) {
      $nl = new Newsletter();
      $nl->setEmail($request->getParameter('email'));
      $nl->save();
      $this->status = 'Olete liitunud';
    } else {
      $this->status = 'Juba olemas';
    }
  }

}
